#include<iostream>
#include<string>
#include<algorithm>

using namespace std;
char num[13]={'0','1','2','3','4','5','6','7','8','9','J','Q','K'};
int main(){
	freopen("input.txt","r",stdin);
	string A,B;
	cin>>A>>B;
	while(A.length()>B.length()){
		A.erase(A.end()-1);
	}
	reverse(A.begin(),A.end());
	reverse(B.begin(),B.end());
	for(int i=0;i<A.length()&&i<B.length();++i){
		if(i%2==1){
			B[i]=B[i]-A[i]>=0?num[B[i]-A[i]]:num[B[i]-A[i]+10];
		}else{
			
			B[i]=(num[(int)(B[i]+A[i]-2*'0')%13]);
		}

	}
	reverse(B.begin(),B.end());
	cout<<B;
	return 0;
}